﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;

namespace GtsServer.Manage.Controller
{
    public class TaskRobotSettingController
    {
        TaskRobotSettingDAL dal = new TaskRobotSettingDAL();
        public TaskRobotSetting GetModelByTaskID(int taskID)
        {
            TaskRobotSetting robotSetting = new TaskRobotSetting();

            robotSetting = dal.GetModel(taskID);
            return robotSetting;
        }

        public bool Edit(TaskRobotSetting model)
        {
            bool isSuccess = model.ID > 0 ? dal.Update(model) : dal.Add(model);
            if (isSuccess)
            {
                StartEndTaskService.ServiceClient client = new StartEndTaskService.ServiceClient();
                client.EditTaskRobotScore(model);
            }
            return isSuccess;
        }
    }
}
